﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Counter1
{
    class Program
    {

        private static void Main()
        {
            //string str = "(8.8*10+2*(3+7)+2)*100-30*(10+90)*3/10";
            //string str3 = "1+(-10.88888)";

            Console.Title = "计算器";
            while(true)
            {
                Console.WriteLine("请输入表达式：('##'退出)\n");
                string str2 = Console.ReadLine();
                if(str2 == null)
                {
                    str2 = string.Empty;
                }

                if(str2.Trim() == "##")
                {
                    Console.WriteLine("\n感谢使用！");
                    break;
                }
                else
                {
                    Communion mode = new Communion(str2);
                    mode.Carryout();
                    if (mode.isnormal && mode.result < 1.7E+308)
                    {
                        Console.WriteLine("\n表达式 '" + mode.equation + "' 的值为： " + mode.result);
                        Console.WriteLine("\n---------------------------------------------------------------------\n" );
                    }
                }

            }







            Console.ReadKey();
        }
    }

}
